package com.etpjava.model;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.etpjava.util.GetSth;

@Entity
@Table(name = "tb_employee")
public class Employee implements Serializable {
	private static final long serialVersionUID = 595818364751017410L;
	private int id;
	private String name;
	private String sex;
	@SuppressWarnings("unused")
	private int age;
	private String employeeacc;
	private String identifycation;
	private Date birthday;
	private String nationality;
	private int isMarried;
	private String politics;
	private String birthplace;
	private String telphone;
	private String address;
	private String graduatedSchool;
	private String specialize;
	private String education;
	private Date firstWorkTime;
	private String workType;
	private Date regedisTtime;
	private String regedistName;
	private String remark;
	private Pay myPay;
	private Department myeDepartment;
	private Set<Reward> mycCjs = new HashSet<Reward>();
	private Set<Train> mytTrains = new HashSet<Train>();
	private Set<Manager> mans=new HashSet<Manager>();

	public String getAddress() {
		return address;
	}
	@Transient
	public int getAge() {
		return GetSth.getAge(this.getBirthday());
	}

	public Date getBirthday() {
		return birthday;
	}

	public String getBirthplace() {
		return birthplace;
	}

	public String getEducation() {
		return education;
	}



	public Date getFirstWorkTime() {
		return firstWorkTime;
	}

	public String getGraduatedSchool() {
		return graduatedSchool;
	}

	@Id
	@GeneratedValue
	public int getId() {
		return id;
	}

	public String getIdentifycation() {
		return identifycation;
	}

	

	@ManyToMany(mappedBy = "employees", cascade = { CascadeType.ALL },fetch=FetchType.EAGER)
	public Set<Reward> getMycCjs() {
		return mycCjs;
	}

	@ManyToOne
	@JoinColumn
	public Department getMyeDepartment() {
		return myeDepartment;
	}

	@OneToOne(mappedBy = "myeEmployee", cascade = { CascadeType.ALL })
	public Pay getMyPay() {
		return myPay;
	}

	@ManyToMany(mappedBy = "myEmployees", cascade = { CascadeType.ALL },fetch=FetchType.EAGER)
	public Set<Train> getMytTrains() {
		return mytTrains;
	}

	public String getNationality() {
		return nationality;
	}

	public String getPolitics() {
		return politics;
	}

	public String getRegedistName() {
		return regedistName;
	}

	public Date getRegedisTtime() {
		return regedisTtime;
	}

	public String getRemark() {
		return remark;
	}

	public String getSex() {
		return sex;
	}

	public String getSpecialize() {
		return specialize;
	}

	public String getWorkType() {
		return workType;
	}

	public int getIsMarried() {
		return isMarried;
	}

	public void setIsMarried(int isMarried) {
		this.isMarried = isMarried;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public void setBirthplace(String birthplace) {
		this.birthplace = birthplace;
	}

	public void setEducation(String education) {
		this.education = education;
	}



	public String getEmployeeacc() {
		return employeeacc;
	}
	public void setEmployeeacc(String employeeacc) {
		this.employeeacc = employeeacc;
	}
	public void setFirstWorkTime(Date firstWorkTime) {
		this.firstWorkTime = firstWorkTime;
	}

	public void setGraduatedSchool(String graduatedSchool) {
		this.graduatedSchool = graduatedSchool;
	}

	@ManyToMany(mappedBy = "courses", cascade = { CascadeType.ALL })
	public void setId(int id) {
		this.id = id;
	}

	public void setIdentifycation(String identifycation) {
		this.identifycation = identifycation;
	}


	@OneToMany(mappedBy = "employee")
	public Set<Manager> getMans() {
		return mans;
	}
	public void setMans(Set<Manager> mans) {
		this.mans = mans;
	}
	public void setMycCjs(Set<Reward> mycCjs) {
		this.mycCjs = mycCjs;
	}

	public void setMyeDepartment(Department myeDepartment) {
		this.myeDepartment = myeDepartment;
	}

	public void setMyPay(Pay myPay) {
		this.myPay = myPay;
	}

	public void setMytTrains(Set<Train> mytTrains) {
		this.mytTrains = mytTrains;
	}

	public void setNationality(String nationality) {
		this.nationality = nationality;
	}

	public void setPolitics(String politics) {
		this.politics = politics;
	}

	public void setRegedistName(String regedistName) {
		this.regedistName = regedistName;
	}

	public void setRegedisTtime(Date regedisTtime) {
		this.regedisTtime = regedisTtime;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public void setSpecialize(String specialize) {
		this.specialize = specialize;
	}

	public void setWorkType(String workType) {
		this.workType = workType;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setTelphone(String telphone) {
		this.telphone = telphone;
	}

	public String getTelphone() {
		return telphone;
	}

}
